/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package officeboost.entity.form;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import officeboost.util.FormTypes;
import org.jbpm.api.ExecutionService;
import org.jbpm.api.ProcessInstance;

/**
 *
 * @author frank
 */
@Entity
public class LeaveForm extends AbstractForm implements Serializable {

    public static final String ENTITY_NAME = "LeaveForm";
    private Long id;
    private String name;
    private String uid; // 前端ID
    private String time_span;
    private String reason;
    private String teacherOpinion;
    private String studentOfficeOpinion;
    private String educationOfficeOpinion;
    private String schoolOpinion;
    private int status;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTime_span() {
        return time_span;
    }

    public void setTime_span(String time_span) {
        this.time_span = time_span;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getTeacherOpinion() {
        return teacherOpinion;
    }

    public void setTeacherOpinion(String teacherOpinion) {
        this.teacherOpinion = teacherOpinion;
    }

    public String getStudentOfficeOpinion() {
        return studentOfficeOpinion;
    }

    public void setStudentOfficeOpinion(String studentOfficeOpinion) {
        this.studentOfficeOpinion = studentOfficeOpinion;
    }

    public String getEducationOfficeOpinion() {
        return educationOfficeOpinion;
    }

    public void setEducationOfficeOpinion(String educationOfficeOpinion) {
        this.educationOfficeOpinion = educationOfficeOpinion;
    }

    public String getSchoolOpinion() {
        return schoolOpinion;
    }

    public void setSchoolOpinion(String schoolOpinion) {
        this.schoolOpinion = schoolOpinion;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public String apply(ExecutionService es) {
        ProcessInstance processInstance = es.startProcessInstanceByKey(FormTypes.LeaveForm.toString(), id.toString());
        return processInstance.getId();
    }    

    @Override
    public String toString() {
	return id+". "+"请假"+"（状态："+status+"）";
    }

    @Override
    public Long theId() {
	return getId();
    }
}
